package com.loyal.loyalerp.humenresource.employee.util;

import java.io.IOException;

import org.springframework.beans.factory.annotation.Autowired;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.loyal.loyalerp.basedata.company.mapper.GyCompanyMapper;
import com.loyal.loyalerp.basedata.company.model.GyCompany;

public class CompanyIdSerialize extends JsonSerializer<Integer> {

	@Autowired
	private GyCompanyMapper companyMapper;
	
	@Override
	public void serialize(Integer companyid, JsonGenerator jg, SerializerProvider arg2)
			throws IOException, JsonProcessingException {
		System.out.println("hahahahaahahha:"+companyid);
		GyCompany company=companyMapper.selectByPrimaryKey(companyid);
		jg.writeString(company.getCompanyname());
	}

}
